package com.blu.jsoup;

import java.util.ArrayList;

import org.jsoup.Jsoup;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;

import com.blu.job.JobCount;
import com.blu.job.invalidlist;

import lombok.extern.slf4j.Slf4j;

@Slf4j
public class MyJsoup {
	
	private static int index = 1;
	private static int count = 1;

	public void a() throws Exception {
		ArrayList<String> list = new ArrayList<String>();
		
		for(String s : JobCount.list) {
			list.add(s);
		}
		
		for (String url : list) {
			try {
				Jsoup.connect(url).userAgent("Mozilla").get();
			} catch (Exception e) {
				JobCount.list.remove(url);
				invalidlist.list.add(url);
				log.info("链接已失效删除："+url);
			}
			Thread.sleep(150);
			log.info(index + "------" + url);
			index++;
		}
		log.info("url数量"+list.size());
		index = 1;
		list.clear();
	}

}
